package com.zjitc.mapper;

import com.zjitc.pojo.Book;
import com.zjitc.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookMapper {
    @Select("select * from book")
    List<Book> findAll();

    @Delete("delete from book where id = #{id}")
    boolean delete(int id);

    @Select("select * from book where id = #{id}")
    Book findOne(int id);

    @Update("update book set name= #{name}, position = #{position} where id = #{id}")
    boolean update(Book book);

    @Insert("insert into book values (null,#{name},#{status},null,#{position},#{lastAt})")
    boolean insert(Book book);

    @Update("update book set status = 1 where id = #{id}")
    boolean borrow(int id);

    @Update("update book set status = 0 where id = #{id}")
    boolean back(int id);
}
